WordPress

推荐列表 站点导航

当前位置:首页 > 建站教程 > WordPress >

JS中行内style怎么写?

来源:网络整理  作者:网友投稿  发布时间:2020-12-29 22:41
行内style的写法为:1、对复合属性的写法是去掉中间的“—”,并将第二个单词大写,代码为【alert(box.style.color)】;...

行内style的写法为:1、对复合属性的写法是去掉中间的“—”,并将第二个单词大写,代码为【alert(box.style.color)】;2、float是关键字有特殊写法,代码为【alert(box.style.float)】。

JS中行内style的写法为:

1、访问元素样式1, stye属性只对行内样式有用

var box = document.getElementById("box");  

2、对复合属性的写法是去掉中间的“—”,并将第二个单词大写。

// alert(box.style.color);

// alert(box.style.fontSize);  

3、float是关键字,因此最好不要这样写

//alert(box.style.float);  

4、对float属性ie和非ie有差异:

// alert(box.style.cssFloat); //非ie

// alert(box.style.styleFloat); //IE专用  

5、给float赋值,且兼容所有浏览器

// typeof box.style.cssFloat !="undefined"?box.style.cssFloat = "right":box.style.styleFloat ="right";  

以上就是JS中行内style怎么写?的详细内容,更多请关注网站的其它相关文章!

JS中行内style怎么写? (https://www.wpmee.com/) javascript教程 第1张

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/wp/10845.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

JS中行内style怎么写?

2020-12-29 编辑:网友投稿

行内style的写法为:1、对复合属性的写法是去掉中间的“—”,并将第二个单词大写,代码为【alert(box.style.color)】;2、float是关键字有特殊写法,代码为【alert(box.style.float)】。

JS中行内style的写法为:

1、访问元素样式1, stye属性只对行内样式有用

var box = document.getElementById("box");  

2、对复合属性的写法是去掉中间的“—”,并将第二个单词大写。

// alert(box.style.color);

// alert(box.style.fontSize);  

3、float是关键字,因此最好不要这样写

//alert(box.style.float);  

4、对float属性ie和非ie有差异:

// alert(box.style.cssFloat); //非ie

// alert(box.style.styleFloat); //IE专用  

5、给float赋值,且兼容所有浏览器

// typeof box.style.cssFloat !="undefined"?box.style.cssFloat = "right":box.style.styleFloat ="right";  

以上就是JS中行内style怎么写?的详细内容,更多请关注网站的其它相关文章!

JS中行内style怎么写? (https://www.wpmee.com/) javascript教程 第1张

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/wp/10845.shtml

相关文章

风云图片

推荐阅读

返回WordPress频道首页